package com.quectel.core.module.ai.entity.mongo;

import com.quectel.constant.BackupConfigConstants;
import com.quectel.core.constants.MongoCollectionConstants;
import com.quectel.util.client.mongo.MongoBaseModel;
import lombok.Data;
import org.springframework.data.mongodb.core.index.CompoundIndex;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.MongoId;

import java.util.Date;

/**
 * 视频事件记录表
 *
 * @author caolu
 * @email louis.cao@quectel.com
 * @date 2021-11-22 11:47:45
 */
@Data
@Document(MongoCollectionConstants.AI_EVENT_RECORD)
@CompoundIndex(name = "idx_device_id", def = "{'deviceId': 1}", background = true)
@CompoundIndex(name = "idx_tenant_village", def = "{'tenantId': 1,'villageId': 1}", background = true)
public class MongoAiEventRecordModel implements MongoBaseModel {

    /**
     * id
     */
    @MongoId
    private Long id;

    /**
     * 租户id
     */
    private Long tenantId;

    /**
     * 小区id
     */
    private Long villageId;

    /**
     * 楼栋id
     */
    private Long buildingId;
    /**
     * 种类id
     */
    private Long deviceCategoryId;

    /**
     * 类型
     */
    private Long deviceTypeId;

    /**
     * 设备id
     */
    private Long deviceId;

    /**
     * 设备名称
     */
    private String deviceName;

    /**
     * 事件类型 1区域入侵 2车牌抓拍 3人脸抓拍
     */
    private Byte eventType;

    /**
     * 抓拍照片
     */
    private String snapImages;

    /**
     * 抓拍录像
     */
    private String snapVideoes;

    /**
     * 事件发生时间
     */
    private Date eventTime;

    /**
     * 事件发生时间
     */
    @Indexed(name = "idx_record_time", background = true, expireAfterSeconds = BackupConfigConstants.MONGO_LOG_DATA_DEFAULT_RETAIN_SECONDS)
    private Date recordTime;
}
